package com.wanxi.system;

public class MaxArray {
    public static void main(String[] args) {
        int[] arr = {11, 22, 245, 3, 4, 5, 6};
        int max = max(arr);
        System.out.println("最大值为:" + max);
    }

    private static int max(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i])
                max = arr[i];
        }
        return max;
    }
}
